
// const count = 20

// {key: 'time',  title:  '跟踪时间' },
// {key: 'province',  title:  '所在省份' },
// {key: 'city',  title:  '所在城市' },
// {key: 'county',  title:  '所在区县' },
// {key: 'address',  title:  '详细地址' },
// {key: 'longitude',  title:  '经度' },
// {key: 'latitude',  title:  '纬度' }

const listOnLine = [
  { plate: '赣H80893', time: '2018-04-12 20:31:17', province: '贵州省', city: '遵义市', county: '遵义市', address: '湄潭县银百高速公路(高速路)', longitude: 107.539616, latitude: 27.646184 },
  { plate: '赣H80893', time: '2018-04-12 16:47:59', province: '重庆市', city: '重庆市', county: '綦江区', address: '綦江区兰海高速公路(高速路)', longitude: 106.742584, latitude: 28.687816 },
  { plate: '赣H80893', time: '2018-04-12 16:47:59', province: '重庆市', city: '重庆市', county: '渝北区', address: '渝北区G319(快速路)', longitude: 106.6568, latitude: 29.755716 }
]

export default {
  getList: config => {
    const { current, size, condition } = JSON.parse(config.body)
    const mockList = listOnLine.filter(item => {
      if (condition !== undefined) {
        // if (condition.plate && item.plate !== condition.plate) return false
      }
      return true
    })
    const pageList = mockList.filter((item, index) => index < size * current && index >= size * (current - 1))
    return {
      'code': 0,
      'data': {
        'total': mockList.length,
        'size': 10,
        'pages': 0,
        'current': 1,
        'searchCount': true,
        'openSort': true,
        'orderByField': null,
        'records': pageList,
        'condition': {
          'name': 'null'
        },
        'asc': true,
        'offsetCurrent': 0
      },
      'message': 'success'
    }
  },
  getDetailList: config => {
    const { current, size, condition } = JSON.parse(config.body)
    const mockList = listOnLine.filter(item => {
      if (condition !== undefined) {
        // if (condition.name && item.name !== condition.name) return false
      }
      return true
    })
    const pageList = mockList.filter((item, index) => index < size * current && index >= size * (current - 1))
    return {
      'code': 0,
      'data': {
        'total': mockList.length,
        'size': 10,
        'pages': 0,
        'current': 1,
        'searchCount': true,
        'openSort': true,
        'orderByField': null,
        'records': pageList,
        'condition': {
          'name': 'null'
        },
        'asc': true,
        'offsetCurrent': 0
      },
      'message': 'success'
    }
  }
}
